package com.imooc.ad.client;

import com.imooc.ad.client.vo.AdPlan;
import com.imooc.ad.client.vo.AdPlanGetRequest;
import com.imooc.ad.vo.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


import java.util.List;

/**
 * 使用Feign调用微服务，指定要调用的微服务的名字
 * */
@FeignClient(value = "eureka-client-ad-sponsor",
            /**绑定实现服务降级*/
            fallback = SponsorClientHystrix.class)
public interface SponsorClient {

    /**
     * 指定调用的请求的映射与方法
     * */
    @RequestMapping(value = "/ad-sponsor/get/adPlan",
                    method = RequestMethod.POST)
    CommonResponse<List<AdPlan>> getAdPlans(
            @RequestBody AdPlanGetRequest request);

}
